//
//  MasterCookBookRes.m
//  Taste
//
//  Created by 徐昊 on 16/9/20.
//  Copyright © 2016年 徐昊. All rights reserved.
//

#import "MasterCookBookRes.h"
#import "MasterCookBookMaterals.h"
#import "MasterCookBookTips.h"
#import "MasterCookBookMore.h"
#import "MasterCookBookSteps.h"

@implementation MasterCookBookRes

- (void)setValue:(id)value forKey:(NSString *)key {
    [super setValue:value forKey:key];
    if ([key isEqualToString:@"materals"]) {
        NSMutableArray *array = [NSMutableArray array];
        for (NSDictionary *dic in value) {
            MasterCookBookMaterals *materals = [MasterCookBookMaterals modelWithDic:dic];
            [array addObject:materals];
        }
        _materals = array;
    }
    if ([key isEqualToString:@"tips"]) {
        NSMutableArray *array = [NSMutableArray array];
        for (NSDictionary *dic in value) {
            MasterCookBookTips *tips = [MasterCookBookTips modelWithDic:dic];
            [array addObject:tips];
        }
        _tips = array;
    }
    if ([key isEqualToString:@"more"]) {
        NSMutableArray *array = [NSMutableArray array];
        for (NSDictionary *dic in value) {
            MasterCookBookMore *more = [MasterCookBookMore modelWithDic:dic];
            [array addObject:more];
        }
        _more = array;
    }
    if ([key isEqualToString:@"steps"]) {
        NSMutableArray *array = [NSMutableArray array];
        for (NSDictionary *dic in value) {
            MasterCookBookSteps *steps = [MasterCookBookSteps modelWithDic:dic];
            [array addObject:steps];
        }
        _steps = array;
    }
    if ([key isEqualToString:@"id"]) {
        _masterCookBookRes_id = value;
    }
    if ([key isEqualToString:@"typename"]) {
        _masterCookBookRes_typename = value;
    }
    if ([key isEqualToString:@"typeid"]) {
        _masterCookBookRes_typeid = value;
    }
    
}

+ (NSDictionary *)objectClassInArray{
    return @{@"tips" : [MasterCookBookTips class], @"materals" : [MasterCookBookMaterals class], @"steps" : [MasterCookBookSteps class], @"more" : [MasterCookBookMore class]};
}

@end
